Editing {songname}.s Files


After this system converts .mid Files  into  .s Files, it creates Sound Object Files. At that point, nearly all of the functions can be written into the .mid File, so there is nearly no need to edit .s Files. 

However, there may be times when you edit the .s files. For example, if the links to the sequencer software are poor and correcting the .mid File would be problematic or you want to reduce the Sound Object by just a few bytes or similar situation. 

For this reason, the "fonts" of the  {songname}.s Files are shown below. 
Note, however that these fonts could be changed with future versions and that they are not guaranteed for future use. 

INDEX   Editing the {songname}.s Files
       (1)   Wxx
       (2)  FINE 
       (3)  GOTO, label
       (4)  PATT, label
       (5)  PEND  
       (6)  REPT, xx, label
       (7)  TEMPO, xx/2
       (8)  KEYSH, xx
       (9)  MEMACC, mem set, adr, dat
      (10)  PRIO, xx
      (11)  VOICE, xx
      (12)  VOL, xx 
      (13)  PAN, c_v+xx
      (14)  BEND, c_v+xx 
      (15)  BENDR, xx  
      (16)  LFOS, xx  
      (17)  LFODL, xx 
      (18)  MOD, xx  
      (19)  MODT, xx 
      (20)  TUNE, c_v+xx 
      (21)  Nxx [,key [,velo [,gtp?] ] ] 
      (22)  TIE [,key[,velo]] 
      (23)  EOT [,key] 
      (24)  XCMD, xIECV, xx 
      (25)  XCMD, xIECL, xx

      (Ref) {songname}.s File Contents

(1) Wxx

Until the following commands have been executed, the system will wait for xx Clocks. These can be thought of as "rests."
xx is a two-digit, single-byte number from 00 ~ 96, but they do not have to be consecutive. 
Values not defined in MusicPlayDef.s cannot be used.)
The length of the rest will be 24 clocks for a quarter rest and 96 clocks for a whole rest. 

Return to Top


(2) FINE

The musical term "fine." This ends the track in question. 

Return to Top


(3) GOTO, label

Unconditional jump to the position of the label. (a label is 4 bytes.)

Return to Top


(4) PATT, label

Calls the pattern of a label. Can be nested up to three times. 

Return to Top


(5) PEND

Ends a pattern and restores it to its call source. If it is not being called from somewhere, it will be ignored. 

Return to Top


(6) REPT, xx, label

Repeats from the position of label through the present location xx number of times. (xx is from 0 ~ 255.) 
If xx is "0," it will repeat without end. (Same as GOTO.) This cannot be nested. 
(This command cannot be specified on the MIDI sequencer.)

Return to Top


(7) TEMPO, xx/2

This sets the tempo of the entire song. (xx is from 22 ~ 510).

Return to Top


(8) KEYSH, xx

This modulates the key of the track in question. (xx is from  -128 ~ + 127).
(This command cannot be specified on a MIDI sequencer.)

Return to Top


(9) MEMACC, mem_set, adr, dat

Instruction for writing data to the memory access area.

[MEMACC Instruction in MIDI File]
Use the MIDI control change numbers 12, 14, and 16(or these plus thirty: 42, 44,46) when inserting the MEMACC instruction into the song data on the MIDI sequencer.

$Bx,12 ($Bx, Substitute for 16)
$Bx,14 Address accessed (0~127, but less than memacc_s)
$Bx,16 Data used for access. (and placing instruction)

MIDI Code Label in .s
$Bx,14,aa, $Bx,16,dd MEMACC, mem_set

This is the point where the control change $Bx,16 is reached and the actual instruction is set so all of $Bx,14 must be set up prior to $Bx,16.
Also, in the sequencer that sorts the control change events with the same timing in descending order,
in place of $Bx,16, you can use $Bx,12.

[MEMACC Instruction in Source File]

The following is the format of the MEMACC instruction in the {songname}.s file.
  Set up dat in mem_set   m4a_memacc_area[ adr ].

mem_set can be input on the MIDI sequencer.
(The range of adr and dat when you directly edit the .s file is 0~255,
and when you input on the MIDI sequencer it is 0~127. Note that adr is less than memacc_s).

Return to Top

(10) PRIO, xx

When this value is added to the priority of a song, it becomes the priority of that track.
(The xx range is 0 to 255 when editing directly in an .s file or 0 to 127 when input using a MIDI sequencer.)

Return to Top


Using the following commands causes the running status to become valid. 
Running status is a function which allows operation from the parameters alone when the same command appears repeatedly and the command itself is omitted. This function allows the amount of data to be reduced. 

(11) VOICE, xx

Selects the tone color.(xx is from 0 to 127). The tone color specified in mks4agb.ini will be selected. 

Return to Top


(12) VOL, xx

Track Volume(xx is 0 to 127) Note: in order to make the master volume song setup valid, xx has to be specified using the formula [Value * {songname}_mvl/mxv].

Return to Top


(13) PAN, c_v+xx

This is the panpot of the track in question. (xx is from -64 ~ + 63.) With CGB compatible sound, hardware restrictions limit you to three stages (right, center and left). 

Return to Top


(14) BEND, c_v+xx

This is the pitch bend of the track in question. (xx os frp,  -64 ~ +63).

Return to Top


(15) BENDR, xx

This is the bend range. (xx is from  0 ~ 127.) Pitch bend sets the maximum width and is expressed as the half tone count. Immediately after starting, this is "2." That is, when the pitch bend value is maximized, the pitch will be a whole tone higher (or lower). 

Return to Top


(16) LFOS, xx

This is the speed of the Low Frequency Oscillator. (xx is from 0 ~ 127.) That is, the speed of modulation and other effects. The higher the value, the faster it will be. 

Return to Top


(17) LFODL, xx

The time from the "key on" point until the LFO becomes valid. (xx is from 0 ~ 127.)   When this value is anything other than zero, modulation and other effects will not work immediately after "key on."  It will start after xxClocks have passed. 

Return to Top


(18) MOD, xx

This is the modulation depth.  (xx is from 0 ~ 127.)

Return to Top


(19) MODT, xx

This is the type of modulation.  xx is selected from the three following types. 

   0 = Vibrato (Scale Change),
   1 = Tremolo (Volume Change),
   2 = Pan (Position Change)

The value immediately after starting is "0" (Scale Change). 

Return to Top


(20) TUNE, c_v+xx

This is tuning. (xx is from -64 ~ + 63.) Fine tunes the track in question over a ±(half tone) range.

Return to Top


The following commands are "Note Commands." Running Status also functions with these commands. 
Additionally, the parameters may be omitted in addition to the commands.

(21) Nxx [,key [,velo [,gtp?] ] ]

Gate Time is the  xx Clock "Note." xx is a single-byte, double-digit number from 00 ~ 96. However, these do not necessarily have to be consecutive. (Numerical values not defined in MusicPlayDef.s cannot be used. The length of the notes is 24 clocks for a quarter note and 96 clocks for a whole note. 

The "key" is the scale, where the following font is written. 
CnM2, CsM2, DnM2, ... , Cn3, Cs3, Dn3, ... , Fn8, Fs8, Gn8

The first half (Cn, Cs, Dn, etc.) is expressed using the names of the notes. 
The first letter of the name of the note is the scale (C ~ B).
The n following stands for natural, the s for sharp. 
The second half  (M2, 0, 3, etc.) indicates the pitch of the note. 
M means minus (moving from lower to higher), it is written as follows. (M2, M1, 0, 1 . . . 7, 8)

The correspondence with MIDI key numbers is as follows. 
CnM2=0, . . . Cn3=36, . . . Gn8=127

velo is velocity, from v000 ~ v127. According to MIDI standards, if the velocity is zero, it will be handled as a "Note Off," but in this source file, v000 is not handled as a "Note Off". 

Also, in the song setting options, when it is set to "do not shorten -e gate time," a parameter called "gtp? (?=1 ~ 3)" may be attached. 
This is for the purpose of adding the amount truncated during data compression to the  Clock once more. 

Refer to "Writing in the mks4agb.ini File" in the Song Setting Options for more information on song setting options. 

Return to Top


(22) TIE [,key [,velo] ]

This is the note that becomes TIE. The note will continue to sound until an "EOT" appears. 
The key is a scale from CnM2 ~ Gn8, and velo is velocity from v000 ~ v127.

Return to Top


(23) EOT [,key]

This command stops the TIE note. The key is the scale of the note to be stopped from CnM2 ~ Gn8.

Return to Top


The following commands are "extension commands (XCMD)."When there are consecutive extension commands, the constant XCMD may be omitted using the running status function. 

(24) XCMD, xIECV, xx

This is Pseudo Echo Volume. (xx is from 00 ~ 127.) With the pseudo echo function, the sound continues at a specific volume and for a specific period after it has been produced and released. 
This function allows an echo-like effect to be placed on the track in question. 
The volume remains at xx /127th of the note in question.

Return to Top


(25) XCMD, xIECL, xx

This is the length of the Pseudo Echo. (xx is from 00 ~ 127.) A pseudo echo will remain for a period of xx/60th of a second. 

Return to Top


(Ref) {songname}.s File Contents

Please refer to .s File Content in the Tutorial  for an explanation of the actual {songname}.s Files. 

Return to Top


Back:[ Operating the System "Simple Monitor" ]
TOP :[ Table of Contents ]